load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "storage",
    srcs = [
        "gc.go",
        "json.go",
        "read.go",
        "save.go",
        "stats_read_writer.go",
        "update.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/statistics/handle/storage",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/infoschema",
        "//pkg/kv",
        "//pkg/meta/model",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/sessionctx",
        "//pkg/sessionctx/vardef",
        "//pkg/sessionctx/variable",
        "//pkg/statistics",
        "//pkg/statistics/asyncload",
        "//pkg/statistics/handle/cache",
        "//pkg/statistics/handle/lockstats",
        "//pkg/statistics/handle/logutil",
        "//pkg/statistics/handle/metrics",
        "//pkg/statistics/handle/types",
        "//pkg/statistics/handle/usage/predicatecolumn",
        "//pkg/statistics/handle/util",
        "//pkg/statistics/util",
        "//pkg/table",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/compress",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/sqlescape",
        "//pkg/util/sqlexec",
        "@com_github_klauspost_compress//gzip",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_tikv_client_go_v2//oracle",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "storage_test",
    timeout = "short",
    srcs = [
        "dump_test.go",
        "gc_test.go",
        "read_test.go",
        "stats_read_writer_test.go",
    ],
    flaky = True,
    shard_count = 29,
    deps = [
        ":storage",
        "//pkg/config/kerneltype",
        "//pkg/domain",
        "//pkg/meta/model",
        "//pkg/parser/ast",
        "//pkg/planner/cardinality",
        "//pkg/sessionctx",
        "//pkg/sessionctx/variable",
        "//pkg/statistics",
        "//pkg/statistics/asyncload",
        "//pkg/statistics/handle/ddl/testutil",
        "//pkg/statistics/handle/internal",
        "//pkg/statistics/handle/types",
        "//pkg/statistics/handle/util",
        "//pkg/statistics/util",
        "//pkg/testkit",
        "//pkg/testkit/analyzehelper",
        "//pkg/types",
        "//pkg/util",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
    ],
)
